<?php
require_once('config.php');
$result = mysql_query("SELECT a.*,b.kode FROM tb_produksi AS a 
						JOIN tb_formula AS b ON (a.id_formula=b.id_formula)
						WHERE id_produksi=$_GET[id]");
$data = mysql_fetch_array($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ERP PT ATHIS</title>
</head>

<body>
<div align="center"><img src="images/athis.png" width="215" height="83" /></div>
<br>
<table align="center" width="843" border="1" cellpadding="1" cellspacing="0">
  <tr>
    <td colspan="2">Tanggal Persiapan </td>
    <td colspan="3"><?php echo $data['tgl_persiapan'];?></td>
  </tr>
  <tr>
    <td colspan="2">Kode Produksi</td>
    <td colspan="3"><?php echo $data['kode_prod'];?></td>
  </tr>
  <tr>
    <td colspan="2">Kode Formula</td>
    <td colspan="3"><?php echo $data['kode'];?></td>
  </tr>
  <tr>
    <td colspan="2">Jumlah Produksi</td>
    <td colspan="3"><?php echo $data['hasil_produksi'];?> Karton</td>
  </tr>
  <tr>
  <div>
    <td colspan="5"><br><br></td>
	</div>
  </tr>
  <tr>
    <td width="20" align="center">No</td>
    <td width="120" align="center">Kode Bahan Baku </td>
    <td width="245" align="center">Nama Bahan Baku</td>
    <td width="260" align="center">Jumlah Barang </td>
    <td width="176" align="center">Satuan Barang </td>
  </tr>
  <?php 
  $result = mysql_query("SELECT a.*,b.nama_bb FROM tb_formula_detail AS a
						JOIN tb_bb AS b ON (a.kode_bb=b.kode_bb)
						WHERE id_formula=$data[id_formula]");
  $no=1;
  while($datadetil = mysql_fetch_array($result)){
  ?>
  <tr>
    <td align="center" valign="top"><?php echo $no;?></td>
    <td align="left" valign="top"><?php echo $datadetil['kode_bb'];?></td>
    <td align="left" valign="top"><?php echo $datadetil['nama_bb'];?></td>
    <td align="center" valign="top"><?php echo $datadetil['jumlah'] * $data['kalian'];?></td>
    <td align="center" valign="top"><?php echo $datadetil['satuan'];?></td>
  </tr>
  <?php 
  $no++;
  }
  ?>
</table>
</body>
</html>
